//
// Created by zuo on 2024/7/1.
// 题目链接 https://www.lanqiao.cn/problems/2490/learning/?page=1&first_category_id=1&problem_id=2490
//


#include<bits/stdc++.h>
using namespace std;

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    int n;
    int flag = 0;
    cin >> n;
    stack<char> s;
    for (int i = 0; i < n; ++i)
    {
        char c;
        cin >> c;
        if (c == '(')
        {
            s.push(c);
        }
        else
        {
            if (s.empty())
            {
                flag = 1;
            }
            else s.pop();
        }
    }
    if (s.empty() && flag == 0) cout << "Yes\n";
    else cout << "No\n";

    return 0;
}
